#include "FiveWin.ch"

#define WM_MDICREATE        544   // 0x0220
#define WM_MDIDESTROY       545   // 0x0221
#define WM_MDIACTIVATE      546   // 0x0222
#define WM_MDIRESTORE       547   // 0x0223
#define WM_MDINEXT          548   // 0x0224
#define WM_MDIMAXIMIZE      549   // 0x0225
#define WM_MDITILE          550   // 0x0226
#define WM_MDICASCADE       551   // 0x0227
#define WM_MDIICONARRANGE   552   // 0x0228
#define WM_MDIGETACTIVE     553   // 0x0229
#define WM_MDISETMENU       554   // 0x0230

//----------------------------------------------------------------------------//

CLASS TMdiClient FROM TWindow

   METHOD New( oWnd, nSubMenu, nIdChildFirst ) CONSTRUCTOR
   METHOD ChildNew( nTop, nLeft, nBottom, nRight, cTitle, nStyle )
   METHOD Tile()         BLOCK { | Self | ::SendMsg( WM_MDITILE ) }
   METHOD Cascade()      BLOCK { | Self | ::SendMsg( WM_MDICASCADE ) }
   METHOD ArrangeIcons() BLOCK { | Self | ::SendMsg( WM_MDIICONARRANGE ) }
   METHOD NextWindow()   BLOCK { | Self | ::SendMsg( WM_MDINEXT ) }

ENDCLASS

//----------------------------------------------------------------------------//

METHOD New( oWnd, nSubMenu, nIdChildFirst ) CLASS TMdiClient

   local cClientCreateStruct := ;
      I2Bin( GetSubMenu( oWnd:oMenu:hMenu, nSubMenu ) ) + ;
      I2Bin( nIdChildFirst )

   ::oWnd = oWnd
   ::hWnd = CreateWindow( "MDICLIENT", "",;
                          nOr( WS_CHILD, WS_CLIPCHILDREN, WS_VISIBLE ),;
                          0, 0, 0, 0, oWnd:hWnd, 1, cClientCreateStruct )
   ::Link()

return

//----------------------------------------------------------------------------//

METHOD ChildNew( nTop, nLeft, nBottom, nRight, cTitle, nStyle ) CLASS TMdiClient

return TMdiChild():New( nTop, nLeft, nBottom, nRight, cTitle, nStyle,, Self )

//----------------------------------------------------------------------------//
